package com.vast.admin.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vast.admin.entity.SysLog;
import com.vast.admin.entity.enums.QueryOrderEnum;
import com.vast.admin.service.SysLogService;
import com.vast.common.constant.MessageCode;
import com.vast.common.core.domain.Result;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 管理员 前端控制器
 * </p>
 *
 * @author zhaohao
 * @since 2019-10-30
 */
@RestController
@Api(value = "日志相关接口", tags = { "日志管理模块" })
@RequestMapping("/manager/log")
public class SysLogController {


	@Autowired
	private SysLogService sysLogService;



	@ApiOperation(value = "查询列表信息", notes = "通过条件查询列表")
	@ApiImplicitParams({
			@ApiImplicitParam(paramType = "query", name = "size", value = "分页条数", dataType = "int", defaultValue = "10", required = false),
			@ApiImplicitParam(paramType = "query", name = "current", value = "页码,起始值:1", dataType = "int", defaultValue = "1", required = false),
			@ApiImplicitParam(paramType = "query", name = "listMode", value = "是否集合模式:true不进行分页直接返回所有结果集", dataType = "boolean", defaultValue = "false", required = false),
			@ApiImplicitParam(paramType = "query", name = "queryItems", value = "查询条件,json集合", defaultValue = "account,EQ,13419519796;", dataType = "String", required = false),
			@ApiImplicitParam(paramType = "query", name = "orderField", value = "排序字段,多个','分隔", defaultValue = "create_time", dataType = "String",  required = false),
			@ApiImplicitParam(paramType = "query", name = "order", value = "排序类型: ASC/DESC", dataType = "QueryOrderEnum",  required = false)
			})
	@GetMapping("/page")
	public Result<IPage<SysLog>> page(@ApiParam(hidden = true) Page<SysLog> page, boolean listMode, String queryItems, String orderField, QueryOrderEnum order) {
		return new Result<IPage<SysLog>>(MessageCode.SUCCESS, "获取成功", sysLogService.queryList(page, listMode, queryItems, orderField,order));

	}



}
